package edu.guet.server.mapper;

import edu.guet.server.model.SemesterStatistic.ChartCount;
import edu.guet.server.model.SemesterStatistic.Discussion;
import edu.guet.server.model.SemesterStatistic.ScoreCount;
import edu.guet.server.model.SemesterStatistic.Student;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.sql.ResultSet;
import java.util.List;
import java.util.Map;

@Mapper
public interface StatisticMapper {

    @MapKey("start_date")
    List<Map<String, Object>> selectSemCount(ChartCount chartCount);

    @Select("        select ur.resource_id\n" +
            "        from unit u\n" +
            "        join unit_resource ur\n" +
            "        on u.unit_id = ur.unit_id\n" +
            "        where semester_id=#{semesterId}")
    List<Integer> findSemResourceIds(Integer semesterId);

    @MapKey("resource_name")
     List<Map<String,Object>> findResoureNameAndCountstu(List<Integer> reIds);

    List<ScoreCount>  findUnitTestScoreCount(Integer unitId);

    List<ScoreCount>  findUnitHmkScoreCounts(Integer unitId);

    Integer findValidScoreCounts(Integer semesterId, int down, int up);

    List<ScoreCount>  findValidScoreCountsList(Integer semesterId);
    Double getMaxValid(Integer semesterId);

    Double getAveValid(Integer semesterId);

    Integer getStuCount(Integer semesterId);

    List<Discussion> getDiscussionData(List<Integer> stuIds);

    List<Student> getStudentData(List<Integer> stuIds,Integer semesterId);
}
